<?php
if ($this->session->userdata('logged_in') == TRUE) {
    $this->load->view('view_login_success');
}
?>
<?php $this->load->view('view_pageheader'); ?>
<script language="JavaScript" type="text/javascript">
  function validateForm() {
      if(document.form2.fname.value==""){
          alert("You didn't enter a MENU NAME");
           return false;
      }
      else if(document.form2.fname2.value==""){
          alert("You didn't enter a LINK");
           return false;
      }
      else if (document.form2.gmenu_id[''].checked == false) {
        alert ( "Please choose Group Menu" );
         return false;
    }
      
    else {
          return true;}
  }
</script>
    <label class="content_linkBack"><?php echo anchor('con_users/menu', '< Back') ?></label>
    <label class="content_this">| EDIT MENU</label>
 <?php $attributes = array( 'id' => 'myform','name'=>'form2','onsubmit'=>'return validateForm();');   
 echo form_open('con_users/edit_menu2',$attributes ); ?>
        <table border="0" style="margin: auto;">
            <? foreach( $edit as $testing ) {?>
            <tr>
                <td><label class="textRight">MENUNAME :</label></td>
                <td><input type="text" name="fname" size="20" value="<?echo $testing->menu_name ?>" />*</td>
            </tr>
            <tr>
                <td><label class="textRight">LINK :</label></td>
                <td><input type="text" name="fname2" size="50" value="<?echo $testing->menu_link ?>" />*</td>
            </tr>
               <tr>
                <td><label class="textRight">Group Menu :</label></td>
            <?php 
            foreach ($group as $row ) { ?>
            <tr>
                <td></td>
                <td>                    
                    <?php 
                    foreach ( $chkgroup as $rows ) {                          
                            if(($rows->gmenu_id)==($row->gmenu_id)) {
                                echo '<input type="checkbox" name="gmenu_id[]" id="gmenu_id" checked="checked" value="' . $row->gmenu_id . '" />' . $row->gmenu_name . '';
                                continue 2;
                            }
                            else {    
                                continue 1;
                            }
                    }  
                    echo '<input type="checkbox" name="gmenu_id[]" id="gmenu_id" value="' . $row->gmenu_id . '" />' . $row->gmenu_name . '';
                    ?>
                </td>
            </tr>
            <?php } ?>
           

            <tr>
                <td colspan="2" style="text-align: center;">
                    <input type="hidden"  name="menuid"  value="<? echo $testing->menu_id ?>" /> 
                    <input type="submit" value="Submit" />&nbsp;<input type="reset" value="Cancel" />
                </td>
            </tr>
            <? }?>
        </table>
<?php echo form_close(); ?>
    
<?php $this->load->view('view_pagefooter'); ?>